<?php
	//echo $_POST["username"];
	//echo "<br/>";
	//echo $_POST["sex"];
	//echo "<br/>";
	//echo $_POST["message"];
	//echo "<br/>";
	//echo "<img src='{$_POST["imgurl"]}'/>";
	$q=$_REQUEST['username'];//昵称
	$w=$_REQUEST['message'];//留言
	$e=$_REQUEST['sex'];
	$r=$_REQUEST['imgurl'];
	date_default_timezone_set("Asia/Shanghai");
	$m_date=date("Y-m-d h:i:s");
	require 'lj.php';
	$sql="insert into t_message(username,message,sex,imgurl,m_date)  values('{$q}','{$w}','{$e}','{$r}','{$m_date}')";
	$rs=$db->query($sql);
	if ($rs==true){
	    header("Location:index.php");
	}else{
	    echo "<script language='javascript'>";
	    echo "alert('添加失败！');";
	    echo "window.location.href='index.php';";
	    echo "</script>";
	}
	$db->close();